<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>俏皮话管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/wechat/witticism/">俏皮话列表</a></li>
		<li class="active"><a href="${ctx}/wechat/witticism/form?id=${witticism.id}">俏皮话<shiro:hasPermission name="wechat:witticism:edit">${not empty witticism.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:witticism:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="witticism" action="${ctx}/wechat/witticism/save" method="post" class="form-horizontal" enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="user.id"/>
		<tags:message content="${message}"/>
		
		
			<shiro:hasPermission name="sys:user:edit">
			<div class="control-group">
				<label class="control-label">是否系统通用:</label>
				<div class="controls">
					 <form:radiobutton path="shareType" value="1"/> 是  
					 <form:radiobutton path="shareType" value="0" checked ="checked"/> 否
				</div>
			</div>
		</shiro:hasPermission>
		
		
			<div class="control-group">
			<label class="control-label">所属模块:</label> 
			<div class="controls">
				<form:select path="type">
					<option value="0">共享</option>
					<option value="1">兑换</option>
					<option value="2">抽奖</option>
					<option value="3">转发</option>
					<option value="4">秒杀</option>
					<option value="5">生日</option>
				</form:select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">类型:</label> 
			<div class="controls">
				<form:select path="category">
					<option value="0">星座</option>
					<option value="1">算命</option>
					<option value="2">笑话</option>
				</form:select>
			</div>
		</div>
		
		<div class="control-group" id="url_id">
			<label class="control-label">图片标题:</label>
			<div class="controls">
				<form:input path="title" htmlEscape="false" class="required"/>
			</div>
		</div>
		<div class="control-group" id="url_id">
			<label class="control-label">图片描述:</label>
			<div class="controls">
				<form:input path="description" htmlEscape="false" class="required"/>
			</div>
		</div>
		
		 <div class="control-group">
			<label class="control-label">图文图片:</label>
			<div class="controls">
				<c:if test="${witticism.picUrl ne '' }">
					<div class="control"><img src="${witticism.picUrl }" style="width:300px;height:100px" enctype="multipart/form-data"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="picFile" htmlEscape="false"   />          
				</div>
			</div>
		</div>
		
		<!-- 
		<div class="control-group" id="url_id">
			<label class="control-label">url地址:</label>
			<div class="controls">
				<input type="text" name="url" >
			</div>
		</div>
		
		<div class="control-group" id="url_id">
			<label class="control-label">编码格式:</label>
			<div class="controls">
					<input type="text" name="unicode" >
			</div>
		</div>
		 -->
		<div class="control-group">
			<label class="control-label">内容:</label>
			<div class="controls">
				<form:textarea path="content" cols="30" rows="5"  htmlEscape="true" class="required"/>
				  <tags:ckeditor replace="content" uploadPath="/project/pics" />
			</div>
		</div>
		
	
		
		
		<div class="form-actions">
			<shiro:hasPermission name="wechat:witticism:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
